package com.bistu.xiong.factory.model.api;

import java.util.Date;

/**
 * Created by XiongXiaoJun on 2017/9/19.
 */

@SuppressWarnings({"WeakerAccess", "unused"})
public class RspModel<T> {
    public static final int SUCCEED = 1;
    public static final int ERROR_UNKNOWN = 0;
    public static final int ERROR_PARAMETERS = 4000;
    public static final int ERROR_EXIST_NAME = 4001;
    public static final int ERROR_EXIST_PHONE = 4002;
    public static final int ERROR_NOT_EXIST_USER = 4003;
    public static final int ERROR_NOT_EXIST_TOKEN = 4004;
    public static final int ERROR_NEED_LOGIN = 4040;
    public static final int ERROR_NOT_FOUND_USER = 4041;
    public static final int ERROR_USER_PASSWORD = 4042;

    private int code;
    private String msg;
    private Date time;
    private T data;

    public boolean success() {
        return code == SUCCEED;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data==null? (T) "" :data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
